home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 30
/
Amiga Format AFCD30 (Sep 1998, Issue 114).iso
/
-seriously_amiga-
/
workbench
/
acknowledge
/
acknowledge.asc
< prev
next >
Wrap
Text File
|
1998-06-18
|
3KB
|
113 lines
;acknowledge
;by James L Boyd ("Do-what-you-like-with-it-ware" :)
; uses RIToolTypesLib and RIAPPLib,plus ElmoreLib
WBStartup
NoCli
.readtooltypes
If GetIconObject("PROGDIR:acknowledge")
message$=FindToolValue("MESSAGE")
x=Val(FindToolValue("X"))
y=Val(FindToolValue("Y"))
If FindToolType("ACKNOWLEDGED") Then status$="Old" Else status$="New" ; set string under icon
FreeIconObject
If message$="" Then message$="Set a message!" ; default message
If x<0 Then x=0 ; basic error-check ;)
If y<0 Then y=0 ; same here
message$=Replace$(message$,"/","|") ; convert /'s to |'s
; reason - the request command uses | to make a new line,but
; / is easier for the user...I think ;)
.appicon
If AddAppIcon (0,status$+" message","PROGDIR:acknowledge",x,y)=0
; 0 is the number of the icon - you could have more than one
; appicon,as long as they have different numbers
; status$ was set above in readtooltypes...
; "PROGDIR:acknowledge" is the location of the icon...you may
; want to change PROGDIR: to the location on your hard drive,
; or temporarily assign PROGDIR: to the location...
; note that you don't add ".info" to the name!
; x and y are the location it will attempt to appear in,as long
; as no other icons are in the way!
Request "Error","AppIcon Failed!|Check icon is named Acknowledge,|and set X and Y in tooltypes to 0!","OK":End
; this ^ happens if the appicon can't be created for some reason
; maybe low chip mem (very low!) or the icon's not found
EndIf
.mainloop
Repeat
VWait 25
If Event=$200 Then Goto quit
Until AppEvent
If AppEventType=2 AND AppNumFiles=0 Then Goto acknowledge Else Goto mainloop
.acknowledge
If Request ("Acknowledge",message$,"Acknowledge|Set New Message")=1 Then acknowledged.b=1:Goto quit
.setmessage
message$=Replace$(message$,"|","/") ; convert \'s to /'s,so they appear like that in the string requester...
tmessage$=message$
message$=RTEZGetString ("Acknowledge","Type message here.A slash / starts a new line...",500,message$)
If message$="" Then message$=tmessage$ ; if they click Cancel,
; you get "" back,hence
; the temp string tmessage$
; "Acknowledge" is the title
; "Type message here..." is the "instruction" text
; 500 is the maximum length of the string
; message$ is optional - what it puts in by default
If message$="" Then message$="Set a message!" ; default text if they choose nothing!
message$=Replace$(message$,"/","|") ; put it back to |'s instead of /'s !
If Request ("Acknowledge","Is this OK?||"+message$,"Accept|Edit")=0 Then Goto setmessage ; check if they like it
message$=Replace$(message$,"|","/") ; convert to user-friendly (?!) way before saving...
Else Request "Acknowledge","Couldn't find icon!|Make sure the program name is Acknowledge!","OK"
; ^ this comes from geticonobject line,just under .readtooltypes
EndIf ; from geticonobject line,just under .readtooltypes
.quit
; save the tooltypes first :
.savetooltypes
If GetIconObject("PROGDIR:acknowledge")
ClearToolTypes
NewToolType "DONOTWAIT",""
NewToolType "MESSAGE",message$
NewToolType "X",Str$(x)
NewToolType "Y",Str$(y)
If acknowledged Then NewToolType "ACKNOWLEDGED",""
PutIconObject ("PROGDIR:Acknowledge")
FreeIconObject
EndIf ; from geticonobject line,just under .savetooltypes
; that's 'em saved!
DelAppIcon(0) ; delete appicon,ID number 0
End ; er,end!